package phoenix.web.page_objects.backend;

import phoenix.core.PhoenixManager;
import phoenix.core.base.extensions.PageBaseWebExt;
import phoenix.web.locators.backend.PhotosPageLocators;

public class PhotosPage extends PageBaseWebExt
{
	public PhotosPage(PhoenixManager p_manager)
	{
		super(p_manager);
	}

	public PhotosPageLocators elements()
	{
		return new phoenix.web.locators.backend.PhotosPageLocators();
	}

	public void clickDecline()
	{
		wd().waitForPresence(elements().linkRestoreDeclinedPhoto, "Link 'Restore declined photo'", false);

		if (wd().isElementPresent(elements().linkRestoreDeclinedPhoto))
		{
			wd().click(elements().linkRestoreDeclinedPhoto);
		}
	}

	public boolean clickApprove()
	{
		wd().waitForPresence(elements().linkApprovePhoto, "Link 'Approve photo'", false);

		if (wd().isElementPresent(elements().linkApprovePhoto))
		{
			wd().click(elements().linkApprovePhoto);
			return true;
		}

		return false;
	}

	public void waitForApprovedPhoto()
	{
		wd().waitForPresence(elements().blockApprovedPhoto, "Block 'Approved Photo'");
	}
}
